package reflect;

import java.lang.reflect.Field;
import java.util.Arrays;

public class ReflectDemo9 {
    public static void main(String[] args) throws Exception {
        String str = "hello";
        String str1 = "hello";

        Class cls = String.class;
        Field field = cls.getDeclaredField("value");
        field.setAccessible(true);
        char[] c = (char[]) field.get(str);
        System.out.println(Arrays.toString(c));

        char[] c1 = new char[]{'1', '2', '3', '4', '5'};
        field.set(str, c1);
        System.out.println("str:"+str);
        System.out.println("str1:"+str1);
        String str2 = "hello";
        System.out.println("hello");
        System.out.println("str2:"+str2);
    }
}
